package com.aboo.action;

import com.aboo.service.SchoolService;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping(value = "/school")
public class SchoolAction {

    @Resource
    SchoolService schoolService;

    @PostMapping(value = "/sayHello")
    public Map<String, Object> sayHello() {
        Map<String, Object> result = new HashMap<>(8);
        Map<String, String> words = schoolService.getWords();
        result.put("flag", "Y");
        result.put("data", words);
        log.info(JSONObject.toJSONString(result));
        System.out.println(JSONObject.toJSONString(result));
        return result;
    }

}
